-
Notifications
You must be signed in to change notification settings - Fork 369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: skip validation for server decompressed objects #1063
Conversation
abf521d
to
85a6671
Compare
Thanks @jkwlui . I am going to make a small tweak to the TODO and get CI Green |
Codecov Report
@@ Coverage Diff @@
## master #1063 +/- ##
==========================================
+ Coverage 99.01% 99.01% +<.01%
==========================================
Files 11 11
Lines 10708 10721 +13
Branches 473 475 +2
==========================================
+ Hits 10602 10615 +13
Misses 106 106
Continue to review full report at Codecov.
|
84336be
to
d79cc37
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
system-test/storage.ts
Outdated
|
||
const file = bucket.file(filename); | ||
file | ||
.createReadStream() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs an on-error handler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Different from the one on line 2269?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that one will catch errors from the write stream, but if the read stream has an error, it would go uncaught currently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like @jkwlui addressed this?
system-test/storage.ts
Outdated
it('should skip validation if file is served decompressed', done => { | ||
const filename = 'logo-gzipped.png'; | ||
bucket | ||
.upload(FILES.logo.path, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re: style comments - the mix of promises and callbacks makes me twitch a bit. Actually the preferred way now is to use async/await, so you could make the lambda passed to it() async and then await on stuff. I think there's a promisify function we have handy for tmp?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for unit tests, I'd be tempted to just use mktempSync
, I don't know that we need a module for this:
https://nodejs.org/api/fs.html#fs_fs_mkdtempsync_prefix_options
I'd also consider switching to to async
/await
, would probably unravel this a bunch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ended up using tmp.fileSync()
since it's already there :)
Probably gonna require more boilerplate code if we'd switch to using fs.mkdTempSync
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is looking pretty reasonable to me, main comment is the same as @feywind's, I'd try to avoid mixing promises and functions; in tests using sync
methods is fine to reduce callback nesting.
system-test/storage.ts
Outdated
it('should skip validation if file is served decompressed', done => { | ||
const filename = 'logo-gzipped.png'; | ||
bucket | ||
.upload(FILES.logo.path, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for unit tests, I'd be tempted to just use mktempSync
, I don't know that we need a module for this:
https://nodejs.org/api/fs.html#fs_fs_mkdtempsync_prefix_options
I'd also consider switching to to async
/await
, would probably unravel this a bunch.
* fix: skip validation for server decompressed objects * fix: formatting changes to todo comment for tracking * fix: lint * fix: remove unnecessary var set * use async/await * listen to response evt on read stream * npm run fix Co-authored-by: Christopher Wilcox <crwilcox@google.com>
Fixes #709